/*
package com.tjbank.cssys.web.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.dcits.comet.rpc.api.model.head.HeadOut;
import com.dcits.comet.rpc.api.model.head.Result;
import com.tjbank.cssys.rpc.domain.CsSysToEsbUploadBean;
import com.tjbank.cssys.rpc.domain.Param;
import com.tjbank.cssys.rpc.service.Rpc_EsbToCsSysGetDataService;
import com.tjbank.cssys.web.util.RedisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class EsbToCsSysGetDataServiceImpl implements Rpc_EsbToCsSysGetDataService {
    private Logger logger = LoggerFactory.getLogger(EsbToCsSysGetDataServiceImpl.class);
    @Autowired
    private RedisService redisService;

    @Override
    public CsSysToEsbUploadBean esbToCsSysGetDataService(Param param) {
        CsSysToEsbUploadBean csSysToEsbUploadBean = new CsSysToEsbUploadBean();
        HeadOut headOut = new HeadOut();
        logger.info("-----Esb调用start -------param:" + JSONObject.toJSONString(param));
        if (null == param.getCardTp() || "".equals(param.getCardTp()) || !("1".equals(param.getCardTp()) || "2".equals(param.getCardTp()))) {
            csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "302", "请求参数卡种不对");
            logger.info("-----Esb调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
            return csSysToEsbUploadBean;
        }
        if ("1".equals(param.getCardTp())) {
            csSysToEsbUploadBean = getRedisInformaion(csSysToEsbUploadBean, headOut);
            return csSysToEsbUploadBean;
        }
        if("2".equals(param.getCardTp())){
            csSysToEsbUploadBean= getCreditRedisInformaion(csSysToEsbUploadBean, headOut);
            return csSysToEsbUploadBean;
        }
        return null;
    }

    */
/**
     * 信贷oss地址和条数
     * @param csSysToEsbUploadBean
     * @param headOut
     * @return
     *//*

    private CsSysToEsbUploadBean getCreditRedisInformaion(CsSysToEsbUploadBean csSysToEsbUploadBean, HeadOut headOut) {
        Map<Object, Object> mapResult = redisService.hmget("CreditEsbFilePathAndCount");
        if (null == mapResult || "".equals(mapResult)) {
            csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "301", "信贷文件没有生成");
            logger.info("-----Esb信贷调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
            return csSysToEsbUploadBean;
        }
        //文件路径
        Object filePath = mapResult.get("CreditEsbFilePath");
        //文件总条数
        Object total = mapResult.get("CreditEsbCount");
        StringBuffer stringBuffer = new StringBuffer("");
        if (null == filePath || "".equals(filePath)) {
            stringBuffer.append("信贷文件路径是空，文件没有生成");
        }
        if (null == total || "".equals(total)) {
            stringBuffer.append("-信贷案件条数是空");
        }
        if (stringBuffer.length() > 0) {
            csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "301", stringBuffer.toString());
            logger.info("-----Esb信贷调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
            return csSysToEsbUploadBean;
        }
        csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "200", "处理成功");
        csSysToEsbUploadBean.getHead().setDownFilePath(filePath.toString());
        csSysToEsbUploadBean.setDataTotNum(Integer.valueOf(total.toString()));
        logger.info("-----Esb信贷调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
        redisService.del("CreditEsbFilePathAndCount");
        return csSysToEsbUploadBean;
    }





    */
/**
     * 获取网贷文件路径条数
     * @param csSysToEsbUploadBean
     * @param headOut
     * @return
     *//*



    private CsSysToEsbUploadBean getRedisInformaion(CsSysToEsbUploadBean csSysToEsbUploadBean, HeadOut headOut) {
        Map<Object, Object> mapResult = redisService.hmget("EsbFilePathAndCount");
        if (null == mapResult || "".equals(mapResult)) {
            csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "301", "网贷文件没有生成");
            logger.info("-----Esb网贷调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
            return csSysToEsbUploadBean;
        }
        //文件路径
        Object filePath = mapResult.get("EsbFilePath");
        //文件总条数
        Object total = mapResult.get("EsbCount");
        StringBuffer stringBuffer = new StringBuffer("");
        if (null == filePath || "".equals(filePath)) {
            stringBuffer.append("网贷文件路径是空，文件没有生成");
        }
        if (null == total || "".equals(total)) {
            stringBuffer.append("-网贷案件条数是空");
        }
        if (stringBuffer.length() > 0) {
            csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "301", stringBuffer.toString());
            logger.info("-----Esb网贷调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
            return csSysToEsbUploadBean;
        }
        csSysToEsbUploadBean = handleParams(headOut, csSysToEsbUploadBean, "200", "处理成功");
        csSysToEsbUploadBean.getHead().setDownFilePath(filePath.toString());
        csSysToEsbUploadBean.setDataTotNum(Integer.valueOf(total.toString()));
        logger.info("-----Esb网贷调用end -------result:" + JSONObject.toJSONString(csSysToEsbUploadBean));
        redisService.del("EsbFilePathAndCount");
        return csSysToEsbUploadBean;
    }

    CsSysToEsbUploadBean handleParams(HeadOut headOut, CsSysToEsbUploadBean csSysToEsbUploadBean, String code, String message) {
        List<Result> listresult = new ArrayList<>();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String curryDate = simpleDateFormat.format(new Date());
        Result result = new Result(code, message);
        listresult.add(result);
        headOut.setRet(listresult);
        headOut.setRetStatus(code);
        headOut.setRunDate(curryDate);
        csSysToEsbUploadBean.setHead(headOut);
        csSysToEsbUploadBean.setTmstmp(System.currentTimeMillis());
        return csSysToEsbUploadBean;
    }
}
*/
